import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'

// 密钥对生成 http://web.chacuo.net/netrsakeypair

const publicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvtrC6Heul1NqqCpYKDDQlgfVrY8hWmaI18w2y3CskO2Nsi5bBaOhbI9/2lCvbTPf9CtVqmuPvZTYui317uv0+XSNMSmbf8q1cUyBfMfS/p0apMKTqCChwLaWVWLtMdUZx4aXxiFXwGj9+JLTtg5O6qW7+R+lL1XP3Kqcj+a/E1nISs47zks0XKCZiSDCoBhQwOKIiRqlXU+G2TTcPAG18vMwp9ajraDO5QgbWU4gVtFF6WwoZaiHi2h3kZlcJPI4KhQWklfKqEOTq+ZHFv7/S5NsVUHl9AqcBnPQYCu4ScSL4lnuY5DYNhIZQI6hN2OHbEAExTNUhXhiVrwj6g56hQIDAQAB'

// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt) // 对需要加密的数据进行加密
}

